fork download
  1. #include "TimerOne.h"
  2.  
  3. static uint8_t cube[8]={
  4. 0b10000000,
  5. 0b00000000,
  6. 0b00000000,
  7. 0b00000000,
  8. 0b00000000,
  9. 0b00000000,
  10. 0b00000000,
  11. 0b00000000
  12. };
  13.  
  14.  
  15.  
  16. enum port_b {
  17. PORTB_RCLK = 0,
  18. PORTB_SRCLK = 1,
  19. PORTB_LAYER_6 = 4,
  20. PORTB_LAYER_7 = 5,
  21. };
  22.  
  23. enum port_c {
  24. PORTC_LAYER_0 = 0,
  25. PORTC_LAYER_1 = 1,
  26. PORTC_LAYER_2 = 2,
  27. PORTC_LAYER_3 = 3,
  28. PORTC_LAYER_4 = 4,
  29. PORTC_LAYER_5 = 5,
  30. };
  31.  
  32. enum port_d {
  33. PORTD_SERIAL_0 = 0,
  34. PORTD_SERIAL_1 = 1,
  35. PORTD_SERIAL_2 = 2,
  36. PORTD_SERIAL_3 = 3,
  37. PORTD_SERIAL_4 = 4,
  38. PORTD_SERIAL_5 = 5,
  39. PORTD_SERIAL_6 = 6,
  40. };
  41.  
  42. void callback(){
  43. static uint8_t current_layer = 0;
  44. static uint8_t layer = 0;
  45. PORTC = 0x00;
  46. PORTB &= ~((0x1 << PORTB_LAYER_6) | (0x1 << PORTB_LAYER_7));
  47. PORTB &= ~(0x1 <<PORTB_RCLK);
  48.  
  49.  
  50. for(int i = 0; i<8 ; i++){
  51. layer = current_layer++ & 7;
  52. PORTB &= ~(0x1 << PORTB_SRCLK);
  53. PORTD = cube[i];
  54. PORTB |= (0x1 << PORTB_SRCLK);
  55. }
  56. PORTB |= (0x1 << PORTB_RCLK);
  57. if(layer <6){
  58. PORTC = (0x1 << layer);
  59. }
  60. else if(current_layer == 6){
  61. PORTB |= (0x1 << PORTB_LAYER_6);
  62. }
  63. else{
  64. PORTB |= (0x1 << PORTB_LAYER_7);
  65. }
  66.  
  67. }
  68. void setup() {
  69. // put your setup code here, to run once:
  70. DDRB = 0xFF;
  71. DDRC = 0xFF;
  72. DDRD = 0xFF;
  73.  
  74. PORTB = 0x00;
  75. PORTC = 0x00;
  76. PORTD = 0x00;
  77.  
  78. Timer1.initialize(2500);
  79. Timer1.attachInterrupt(callback);
  80. }
  81.  
  82. void loop() {
  83. // put your main code here, to run repeatedly:
  84. }
  85.  
  86.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:10: fatal error: 'TimerOne.h' file not found
#include "TimerOne.h"
         ^~~~~~~~~~~~
1 error generated.
stdout
Standard output is empty